﻿using Fast.ConfigureOptions;
using Microsoft.Extensions.Configuration;
using System;

namespace Fast
{
    /// <summary>
    /// 应用全局配置
    /// </summary>
    [SkipScan]
    public sealed class AppSettingsOptions : IConfigureOptions<AppSettingsOptions>
    {
        /// <summary>
        /// 是否集成 MiniProfiler 组件
        /// </summary>
        public bool? HasInjectMiniProfiler { get; set; }

        /// <summary>
        /// 是否启用 Swagger
        /// </summary>
        public bool? HasEnableSwaggerDocument { get; set; }

        /// <summary>
        /// 外部程序集
        /// </summary>
        public string[] ExternalAssemblies { get; set; }

        public void PostConfigure(AppSettingsOptions options, IConfiguration configuration)
        {
            options.HasInjectMiniProfiler ??= true;
            options.HasEnableSwaggerDocument ??= true;
            options.ExternalAssemblies ??= Array.Empty<string>();
        }
    }
}
